package com.test09_抽象类和接口;

/**
 * 适配器设计模式
 */
public class YootkDemo_05 {

    public static void main(String[] args) {
        IBook5 bookA = new MathBookAdapter5();
        bookA.read();
        IBook5 bookB = new LoveBookAdapter5();
        bookB.message();
        IBook5 bookC = new ProgramBookAdapter5();
        bookC.create();
    }
}

interface IBook5 {
    public void read();
    public void create();
    public void message();
}

/**
 * 定义适配器
 * 假实现接口中的方法
 */
abstract class BookAdapter5 implements IBook5 {
    @Override
    public void read() {
    }

    @Override
    public void create() {
    }

    @Override
    public void message() {
    }
}

class MathBookAdapter5 extends BookAdapter5 implements IBook5 {
    @Override
    public void read() {
        System.out.println("【MathBook】学习数学");
    }
}

class LoveBookAdapter5 extends BookAdapter5 implements IBook5 {
    @Override
    public void message() {
        System.out.println("【LoveBook】传递爱意");
    }
}

class ProgramBookAdapter5 extends BookAdapter5 implements IBook5 {
    @Override
    public void create() {
        System.out.println("【ProgramBook】创建未来网络");
    }
}
